package com.atguigu.chapter13

object HigherOrderFunction {
  def test(f: Double => Double, f2: Double => Int, n1: Double): Double = {
    f(f2(n1)) // f(0)
  }

  //sum 是接收一个Double,返回一个Double
  def sum(d: Double): Double = {
    d + d
  }

  def mod(d: Double): Int = {
    d.toInt % 2
  }

  def main(args: Array[String]): Unit = {
    val res = test(sum, mod, n1 = 5.0) //
    println("res=" + res) // 2.0

  }
}
